package com.inet.p10_progressbar;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        ProgressBar progress = findViewById(R.id.progressbar);

        Button btn = findViewById(R.id.btn);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (progress.getVisibility() == View.GONE) {
                    progress.setVisibility(View.VISIBLE);

                } else  {
                    progress.setVisibility(View.GONE);

                }

            }
        });


    }


    public void loadData(View view) {
        ProgressBar pb02 = findViewById(R.id.pb02);
        Button btn = findViewById(R.id.btn02);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                pb02.setProgress(pb02.getProgress() + 10);
            }
        });


    }
}